import { request, getToken } from '@inbiz/utils';

const token = getToken();

// 上传头像
export async function UploadAppThumb(params: any) {
  return request('/ImageType/ImgCut', {
    method: 'POST',
    requestType: 'form',
    data: params,
  });
}

export async function getStrategy() {
  return request(`/api/LoginVerification/GetLoginAndPasswordStrategy?token=${token}`);
}

// 修改用户信息
export function setUserInfo(params: any) {
  return request(`/WebCore`, {
    method: 'POST',
    data: {
      module: 'WebClient',
      fun: 'SaveUserInfo',
      ModifyPerDetails_txtRealname: params.realName,
      ModifyPerDetails_txtBirthday: '',
      ModifyPerDetails_chkGenderMale: params.genderMale,
      ModifyPerDetails_txtEmail: params.email,
      ModifyPerDetails_txtTelephone: '',
      ModifyPerDetails_txtMobile: params.mobile,
    },
    requestType: 'form',
  });
}

export async function GetUserInfoByToken(params: any) {
  return request('/api/services/OrgUser/GetUserInfoByToken', {
    params,
  });
}

// 注销登录
export async function WebCore(params: any) {
  return request('/WebCore', {
    method: 'POST',
    requestType: 'form',
    data: params,
  });
}

// 修改密码
export async function setPassword(data: any) {
  return request(`/inbiz/portal/default/EditPassword?token=${token}`, {
    method: 'post',
    data,
    requestType: 'form',
  });
}
